# 生成幂
from itertools import chain, combinations  # 引入完成需求所需的模块


def powerset(s):  # 创建函数powerset
    return list(chain.from_iterable(combinations(s, r) for r in range(len(s) + 1)))  # 返回列表并调用chain和combinations


s = {1, 2, 3, 4, 5}  # 给返回变量s赋值
print(powerset(s))   # 打印函数powerset(s)
print("")
